<template>
  <div class="wrap">
    <div class="left">
      <img src="../../assets/img/logo.gif" alt="" srcset="" />
      <div class="txt">
        <h2>进思学院后台管理</h2>
      </div>
    </div>
    <div class="right">
      <ul>
        <li>卓新思创</li>
        <li>在线客服</li>
        <li>常见问题</li>
        <li>安全中心</li>
        <li @click="denglu">{{ info }}</li>
        <li @click="cancellation">退出</li>
      </ul>
    </div>
  </div>
</template>

<script>
export default {
  computed: {
    info() {
      return this.$store.state.user_name ? this.$store.state.user_name : "登录";
    },
  },
  methods: {
    cancellation() {
      //退出
      localStorage.clear();
      sessionStorage.clear();
      window.open("about:blank", "_self");
      window.close();
    },
    denglu() {
      // 进入页面，点击头部导航登录，进入登录页
      if (!this.$store.state.user_name) {
        this.$router.push({
          name: "login",
        });
      } else {
        // 没有就跳转详情组件
        this.$router.push({
          name: "details", //********//
        });
      }
    },
  },
};
</script>

<style lang="scss" scoped>
.wrap {
  display: flex;
  justify-content: space-between;
  .left {
    margin-top: 10px;
    display: flex;
    align-items: center;
    img {
      width: 90px;
      height: 60px;
    }
  }
  .right {
    margin-top: 10px;
    color: white;
    display: flex;
    align-items: center;
  }
}
ul {
  display: flex;
  li {
    font-weight: 600;
    padding-right: 10px;

  }
}
.txt {
  color: white;
  display: flex;
  align-items: center;
  padding: 10px;
}
</style>